package com.ymatou.iapi.accounting.testcase;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.accounting.parameter.*;
import com.ymatou.iapi.accounting.service.*;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymt.utils.tag.P2;
import com.ymt.utils.tag.P3;
import com.ymttest.business.service.AccountCallService;
import com.ymttest.business.service.AccountCallServiceV2;
import com.ymttest.database.model.Account;
import com.ymttest.database.model.AccountEntry;
import com.ymttest.database.sqlwapper.AccountWapper;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.TestDataManager;
import com.ymttest.utils.constant.ECode;

/**
 * 出进账接口 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_Accounting {
	private static AccountingBean accountingBean;
	private static AccountingCall accountingCall;
	// accountid1 默认客户账户
	private static String accountid1;
	// accountid2 默认商家账户
	private static String accountid2;
	// accountid3 默认系统账户
	private static String accountid3;
	// accountid4 Test账户
	private static String accountid4;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("出进账接口");
		// 全TestSuite初始化数据
		try {
			accountid1 = AccountCallServiceV2.getAccountId(Integer.valueOf(EnvSetup.getData("accountuid1")));
			accountid2 = AccountCallServiceV2.getAccountId(Integer.valueOf(EnvSetup.getData("accountuid2")));
			accountid3 = AccountCallServiceV2.getAccountId(Integer.valueOf(EnvSetup.getData("accountuid3")));
			accountid4 = AccountCallServiceV2.getAccountId(Integer.valueOf(EnvSetup.getData("accountuid4")));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	@Before
	public void caseUp() {
		accountingBean = new AccountingBean();
		accountingCall = new AccountingCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(accountingCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	/**
	 * AccountingItem转换成可以和数据库比较的结果集，需要运算不同操作(AccountOperateType)
	 * 时Entrytype和amount的值
	 * 
	 * @param AccountingItem
	 *            传入参数
	 * @return Map
	 */
	public Map getAccountInfoByAccounting(AccountingItemBean AccountingItem) {
		Map m = new HashMap();
		switch (AccountingItem.getAccountOperateType()) {
		case 1:
			// 余额进账
			m.put("Entrytype", 2);
			m.put("amount", AccountingItem.getAmount());
			break;
		case 2:
			// 余额出账
			m.put("Entrytype", 2);
			m.put("amount", new BigDecimal(0).subtract(AccountingItem.getAmount()));
			break;
		case 3:
			// 冻结入账
			m.put("Entrytype", 1);
			m.put("amount", AccountingItem.getAmount());
			break;
		case 4:
			// 冻结出账
			m.put("Entrytype", 1);
			m.put("amount", new BigDecimal(0).subtract(AccountingItem.getAmount()));
			break;
		default:
			break;
		}
		return m;

	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_Accounting_001() {
		Logger.start(true, "传入数据库存在的AccountId进行单笔进账操作,单笔进账成功,验证余额和流水表数据");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(0), new BigDecimal(0));
			BigDecimal amount = new BigDecimal(10);
			String appid = "AutoTest";
			// 支付充值
			int bizcode = 100001;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItems.add(AccountCallServiceV2.getFundinBean(accountid1, amount, bizcode, oNo));
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(0, accountingCall.getStatus(), "验证StatusCode");
			Logger.comment("验证流水");
			AccountEntry yae = new AccountWapper().selectAccountEntry(accountid1, oNo).get(0);
			Logger.verifyEquals(accountid1, yae.getAccountId(), "数据库验证accountid");
			Logger.verifyEquals(0, amount.compareTo(yae.getAmount()), "数据库验证发生金额amount");
			Logger.verifyEquals(appid, yae.getAppId(), "数据库验证AppId");

			Logger.verifyEquals(0, amount.compareTo(yae.getAvailAmount()), "数据库验证Availamount");
			Logger.verifyEquals(bizcode, yae.getBizCode(), "数据库验证Bizcode");
			Logger.verifyEquals(AccountingItems.get(0).getBizNo(), yae.getBizNo(), "数据库验证Bizcode");
			// 2 可用余额
			Logger.verifyEquals(2, yae.getEntryType(), "数据库验证Entrytype");
			Logger.verifyEquals(AccountingItems.get(0).getMemo(), yae.getMemo(), "数据库验证Memo");
			Logger.verifyEquals(oNo, yae.getOriginalNo(), "数据库验证Originalno");
			Logger.verifyEquals(Integer.valueOf(EnvSetup.getData("accountuid1")), yae.getUserId(), "数据库验证Userid");
			Logger.comment("验证金额");
			Account accountmap = new AccountWapper().selectAccountInfo(accountid1).get(0);
			BigDecimal fAvailAmount = new BigDecimal(accountmap.getAvailAmount().toString());
			BigDecimal fFreezeAmount = new BigDecimal(accountmap.getFreezeAmount().toString());
			Logger.verifyEquals(0, amount.compareTo(fAvailAmount), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fFreezeAmount), "数据库验证fFreezeAmount");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_002() {
		Logger.start(true, "传入数据库存在的AccountId进行10笔进账操作,10笔进账成功,验证余额和流水表数据");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(0), new BigDecimal(0));
			BigDecimal amount = new BigDecimal(10);
			String appid = "AutoTest";
			int bizcode = 100001;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			ArrayList<String> oNolist = new ArrayList<String>();
			for (int i = 0; i < 10; i++) {
				String ono = TestDataManager.getRandomUUID().toString();
				oNolist.add(ono);
				AccountingItems.add(AccountCallServiceV2.getFundinBean(accountid1, amount, bizcode, ono));
				accountingBean.setAccountingItems(AccountingItems);
			}
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(0, accountingCall.getStatus(), "验证StatusCode");
			int i = 0;
			BigDecimal amount1 = new BigDecimal(0);
			Logger.comment("验证流水");
			Logger.comment("循环验证10条记录");
			for (String oNo : oNolist) {
				Logger.comment("第" + i + "条记录验证结果");
				amount1 = amount1.add(new BigDecimal(10.00));
				AccountEntry yae = new AccountWapper().selectAccountEntry(accountid1, oNo).get(0);
				Logger.verifyEquals(accountid1, yae.getAccountId(), "数据库验证accountid");
				Logger.verifyEquals(0, amount.compareTo(yae.getAmount()), "数据库验证发生金额amount");
				Logger.verifyEquals(appid, yae.getAppId(), "数据库验证AppId");
				Logger.verifyEquals(0, amount1.compareTo(yae.getAvailAmount()), "数据库验证Availamount");
				Logger.verifyEquals(bizcode, yae.getBizCode(), "数据库验证Bizcode");
				Logger.verifyEquals(AccountingItems.get(i).getBizNo(), yae.getBizNo(), "数据库验证Bizcode");
				// 2 可用余额
				Logger.verifyEquals(2, yae.getEntryType(), "数据库验证Entrytype");
				Logger.verifyEquals(AccountingItems.get(0).getMemo(), yae.getMemo(), "数据库验证Memo");
				Logger.verifyEquals(oNo, yae.getOriginalNo(), "数据库验证Originalno");
				Logger.verifyEquals(Integer.valueOf(EnvSetup.getData("accountuid1")), yae.getUserId(), "数据库验证Userid");
				i++;
			}
			Logger.comment("验证金额");
			Account accountmap = new AccountWapper().selectAccountInfo(accountid1).get(0);
			BigDecimal fAvailAmount = new BigDecimal(accountmap.getAvailAmount().toString());
			BigDecimal fFreezeAmount = new BigDecimal(accountmap.getFreezeAmount().toString());
			Logger.verifyEquals(0, amount1.compareTo(fAvailAmount), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fFreezeAmount), "数据库验证fFreezeAmount");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_003() {
		Logger.start(false, "传入数据库存在的AccountId进行101笔进账操作,进账项超限失败");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(0), new BigDecimal(0));
			BigDecimal amount = new BigDecimal(10);
			String appid = "AutoTest";
			int bizcode = 100001;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			ArrayList<String> oNolist = new ArrayList<String>();
			for (int i = 0; i < 101; i++) {
				String ono = TestDataManager.getRandomUUID().toString();
				oNolist.add(ono);
				AccountingItems.add(AccountCallServiceV2.getFundinBean(accountid1, amount, bizcode, ono));
				accountingBean.setAccountingItems(AccountingItems);
			}
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(2, accountingCall.getStatus(), "验证StatusCode");
			Logger.verifyEquals(ECode.INSTRUCTION_TOO_LONG, accountingCall.getMsg(), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_004() {
		Logger.start(false, "传入数据库不存在的AccountId进行单笔进账操作,找不到对应账号信息失败");
		try {
			String erraccountid = TestDataManager.getRandomUUID().toString();
			BigDecimal amount = new BigDecimal(10);
			String appid = "AutoTest";
			int bizcode = 100001;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItems.add(AccountCallServiceV2.getFundinBean(erraccountid, amount, bizcode, oNo));
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(ECode.ACCOUNT_NOT_FOUND_CODE, accountingCall.getStatus(), "验证StatusCode");
			Logger.verifyIsContains(ECode.ACCOUNT_NOT_FOUND, accountingCall.getMsg(), "验证Msg包含信息");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_Accounting_005() {
		Logger.start(true, "相同数据单笔多次调用,都返回成功,但是只有一笔影响到余额和流水");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(0), new BigDecimal(0));
			BigDecimal amount = new BigDecimal(10);
			String appid = "AutoTest";
			int bizcode = 100001;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItemBean bean = AccountCallServiceV2.getFundinBean(accountid1, amount, bizcode, oNo);
			AccountingItems.add(bean);
			accountingBean.setAccountingItems(AccountingItems);
			Logger.comment("第一次发送");
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(0, accountingCall.getStatus(), "验证StatusCode");
			Logger.comment("验证流水");
			AccountEntry yae = new AccountWapper().selectAccountEntry(accountid1, oNo).get(0);
			Logger.verifyEquals(accountid1, yae.getAccountId(), "数据库验证accountid");
			Logger.verifyEquals(0, amount.compareTo(yae.getAmount()), "数据库验证发生金额amount");
			Logger.verifyEquals(appid, yae.getAppId(), "数据库验证AppId");

			Logger.verifyEquals(0, amount.compareTo(yae.getAvailAmount()), "数据库验证Availamount");
			Logger.verifyEquals(bizcode, yae.getBizCode(), "数据库验证Bizcode");
			Logger.verifyEquals(AccountingItems.get(0).getBizNo(), yae.getBizNo(), "数据库验证Bizcode");
			// 2 可用余额
			Logger.verifyEquals(2, yae.getEntryType(), "数据库验证Entrytype");
			Logger.verifyEquals(AccountingItems.get(0).getMemo(), yae.getMemo(), "数据库验证Memo");
			Logger.verifyEquals(oNo, yae.getOriginalNo(), "数据库验证Originalno");
			Logger.verifyEquals(Integer.valueOf(EnvSetup.getData("accountuid1")), yae.getUserId(), "数据库验证Userid");
			Logger.comment("第二次发送");
			accountingCall = new AccountingCall();
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(4, accountingCall.getStatus(), "验证StatusCode");
			Logger.verifyIsContains(ECode.IDEMPOTENT, accountingCall.getMsg(), "验证Msg包含信息");
			List<AccountEntry> yaelist = new AccountWapper().selectAccountEntry(accountid1, oNo);
			Logger.verifyEquals(1, yaelist.size(), "数据库验证记录条数还是一条");
			Logger.comment("验证金额");
			Account accountmap = new AccountWapper().selectAccountInfo(accountid1).get(0);
			BigDecimal fAvailAmount = new BigDecimal(accountmap.getAvailAmount().toString());
			BigDecimal fFreezeAmount = new BigDecimal(accountmap.getFreezeAmount().toString());
			Logger.verifyEquals(0, amount.compareTo(fAvailAmount), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fFreezeAmount), "数据库验证fFreezeAmount");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_006() {
		Logger.start(false, "相同数据多笔操作,返回失败,验证金额和流水不变");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(0), new BigDecimal(0));
			BigDecimal amount = new BigDecimal(10);
			String appid = "AutoTest";
			int bizcode = 100001;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItemBean bean = AccountCallServiceV2.getFundinBean(accountid1, amount, bizcode, oNo);
			AccountingItems.add(bean);
			AccountingItems.add(bean);
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(2, accountingCall.getStatus(), "验证StatusCode");
			Logger.verifyEquals(ECode.INSTRUCTION_REPEAT, accountingCall.getMsg(), "验证Msg");
			Account m = new AccountWapper().selectAccountInfo(accountid1).get(0);
			Logger.verifyEquals(String.valueOf("0.00"), m.getAvailAmount().toString(), "数据库验证Availamount");
			Logger.verifyEquals(String.valueOf("0.00"), m.getFreezeAmount().toString(), "数据库验证fFreezeAmount");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_007() {
		Logger.start(false, "传入Amount小于0的单笔进账操作,金额小于0失败");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(0), new BigDecimal(0));
			BigDecimal amount = new BigDecimal(-10);
			String appid = "AutoTest";
			int bizcode = 100001;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItems.add(AccountCallServiceV2.getFundinBean(accountid1, amount, bizcode, oNo));
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(2, accountingCall.getStatus(), "验证StatusCode");
			Logger.verifyEquals(ECode.AMOUNT_GREATER_THEN_ZERO, accountingCall.getMsg(), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_008() {
		Logger.start(false, "传入Amount等于0的单笔进账操作,金额等于0失败");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(0), new BigDecimal(0));
			BigDecimal amount = new BigDecimal(0);
			String appid = "AutoTest";
			int bizcode = 100001;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItems.add(AccountCallServiceV2.getFundinBean(accountid1, amount, bizcode, oNo));
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(2, accountingCall.getStatus(), "验证StatusCode");
			Logger.verifyEquals(ECode.AMOUNT_GREATER_THEN_ZERO, accountingCall.getMsg(), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_009() {
		Logger.start(false, "传入OriginalNo原始单号长度超出100位,参数异常失败");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(0), new BigDecimal(0));
			BigDecimal amount = new BigDecimal(10);
			String appid = "AutoTest";
			int bizcode = 100001;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomNum(101);
			AccountingItems.add(AccountCallServiceV2.getFundinBean(accountid1, amount, bizcode, oNo));
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(2, accountingCall.getStatus(), "验证StatusCode");
			Logger.verifyEquals(ECode.ORIGINALNO_ERROR, accountingCall.getMsg(), "验证Msg");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_010() {
		Logger.start(false, "传入BizNo业务流水号长度超出100位,参数异常失败");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(0), new BigDecimal(0));
			BigDecimal amount = new BigDecimal(10);
			String appid = "AutoTest";
			int bizcode = 100001;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItemBean bean = AccountCallServiceV2.getFundinBean(accountid1, amount, bizcode, oNo);
			String bizNo = TestDataManager.getRandomNum(101);
			;
			bean.setBizNo(bizNo);
			AccountingItems.add(bean);
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(2, accountingCall.getStatus(), "验证StatusCode");
			Logger.verifyEquals(ECode.BIZNO_ERROR, accountingCall.getMsg(), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_011() {
		Logger.start(false, "传入BizCode业务动作代码小于0,参数异常失败");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(0), new BigDecimal(0));
			BigDecimal amount = new BigDecimal(10);
			String appid = "AutoTest";
			int bizcode = -1;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItems.add(AccountCallServiceV2.getFundinBean(accountid1, amount, bizcode, oNo));
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(2, accountingCall.getStatus(), "验证StatusCode");
			Logger.verifyEquals(ECode.BIZNO_NOT_FOUND, accountingCall.getMsg(), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_012() {
		Logger.start(false, "传入不存在的BizCode业务动作代码,参数异常失败");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(0), new BigDecimal(0));
			BigDecimal amount = new BigDecimal(10);
			String appid = "AutoTest";
			int bizcode = 123456;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItems.add(AccountCallServiceV2.getFundinBean(accountid1, amount, bizcode, oNo));
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(2, accountingCall.getStatus(), "验证StatusCode");
			Logger.verifyEquals(ECode.BIZNO_NOT_FOUND, accountingCall.getMsg(), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_Accounting_013() {
		Logger.start(true, "传入Memo备注长度超出1000位,成功,保存内容自动截取1000位");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(0), new BigDecimal(0));
			BigDecimal amount = new BigDecimal(10);
			String appid = "AutoTest";
			int bizcode = 100001;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItemBean bean = AccountCallServiceV2.getFundinBean(accountid1, amount, bizcode, oNo);
			String memo = TestDataManager.getRandomNum(1001);
			bean.setMemo(memo);
			AccountingItems.add(bean);
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(0, accountingCall.getStatus(), "验证StatusCode");
			Logger.comment("验证流水");
			AccountEntry yae = new AccountWapper().selectAccountEntry(accountid1, oNo).get(0);
			Logger.verifyEquals(accountid1, yae.getAccountId(), "数据库验证accountid");
			Logger.verifyEquals(0, amount.compareTo(yae.getAmount()), "数据库验证发生金额amount");
			Logger.verifyEquals(appid, yae.getAppId(), "数据库验证AppId");

			Logger.verifyEquals(0, amount.compareTo(yae.getAvailAmount()), "数据库验证Availamount");
			Logger.verifyEquals(bizcode, yae.getBizCode(), "数据库验证Bizcode");
			Logger.verifyEquals(AccountingItems.get(0).getBizNo(), yae.getBizNo(), "数据库验证Bizcode");
			// 2 可用余额
			Logger.verifyEquals(2, yae.getEntryType(), "数据库验证Entrytype");
			Logger.verifyEquals(memo.substring(0, 1000), yae.getMemo(), "数据库验证Memo截取1000位");
			Logger.verifyEquals(oNo, yae.getOriginalNo(), "数据库验证Originalno");
			Logger.verifyEquals(Integer.valueOf(EnvSetup.getData("accountuid1")), yae.getUserId(), "数据库验证Userid");
			Logger.comment("验证金额");
			Account accountmap = new AccountWapper().selectAccountInfo(accountid1).get(0);
			BigDecimal fAvailAmount = new BigDecimal(accountmap.getAvailAmount().toString());
			BigDecimal fFreezeAmount = new BigDecimal(accountmap.getFreezeAmount().toString());
			Logger.verifyEquals(0, amount.compareTo(fAvailAmount), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fFreezeAmount), "数据库验证fFreezeAmount");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_014() {
		Logger.start(true,"不输入AccountId传入userid和AccountType和CurrencyType(对应AccountId不存在)进行单笔进账操作,自动创建账号并进账成功,验证余额和流水表数据");
		try {
			BigDecimal amount = new BigDecimal(10);
			String appid = "AutoTest";
			int bizcode = 100001;
			int newuid = AccountCallServiceV2.getNewUid();
			String newaccountid = "";
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItemBean bean = AccountCallServiceV2.getFundinBean(null, amount, bizcode, oNo);
			bean.setUserId(newuid);
			bean.setAccountType(1);
			bean.setCurrencyType(1);
			AccountingItems.add(bean);
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(0, accountingCall.getStatus(), "验证StatusCode");
			newaccountid = AccountCallServiceV2.getAccountId(newuid);
			Logger.comment("获取uid:" + newuid + ":newaccountid:" + newaccountid);
			Logger.comment("验证流水");
			AccountEntry yae = new AccountWapper().selectAccountEntry(newaccountid, oNo).get(0);
			Logger.verifyEquals(newaccountid, yae.getAccountId(), "数据库验证accountid");
			Logger.verifyEquals(0, amount.compareTo(yae.getAmount()), "数据库验证发生金额amount");
			Logger.verifyEquals(appid, yae.getAppId(), "数据库验证AppId");

			Logger.verifyEquals(0, amount.compareTo(yae.getAvailAmount()), "数据库验证Availamount");
			Logger.verifyEquals(bizcode, yae.getBizCode(), "数据库验证Bizcode");
			Logger.verifyEquals(AccountingItems.get(0).getBizNo(), yae.getBizNo(), "数据库验证Bizcode");
			// 2 可用余额
			Logger.verifyEquals(2, yae.getEntryType(), "数据库验证Entrytype");
			Logger.verifyEquals(AccountingItems.get(0).getMemo(), yae.getMemo(), "数据库验证Memo");
			Logger.verifyEquals(oNo, yae.getOriginalNo(), "数据库验证Originalno");
			Logger.verifyEquals(newuid, yae.getUserId(), "数据库验证Userid");
			Logger.comment("验证金额");
			Account accountmap = new AccountWapper().selectAccountInfo(newaccountid).get(0);
			BigDecimal fAvailAmount = new BigDecimal(accountmap.getAvailAmount().toString());
			BigDecimal fFreezeAmount = new BigDecimal(accountmap.getFreezeAmount().toString());
			Logger.verifyEquals(0, amount.compareTo(fAvailAmount), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fFreezeAmount), "数据库验证fFreezeAmount");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_015() {
		Logger.start(true, "不输入AccountId传入userid和AccountType(对应AccountId已存在)进行单笔进账操作,进账成功,验证余额和流水表数据");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(0), new BigDecimal(0));
			BigDecimal amount = new BigDecimal(10);
			String appid = "AutoTest";
			int bizcode = 100001;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItemBean bean = AccountCallServiceV2.getFundinBean(accountid1, amount, bizcode, oNo);
			bean.setAccountId(null);
			bean.setAccountType(1);
			bean.setUserId(Integer.valueOf(EnvSetup.getData("accountuid1")));
			AccountingItems.add(bean);
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(0, accountingCall.getStatus(), "验证StatusCode");
			Logger.comment("验证流水");
			AccountEntry yae = new AccountWapper().selectAccountEntry(accountid1, oNo).get(0);
			Logger.verifyEquals(accountid1, yae.getAccountId(), "数据库验证accountid");
			Logger.verifyEquals(0, amount.compareTo(yae.getAmount()), "数据库验证发生金额amount");
			Logger.verifyEquals(appid, yae.getAppId(), "数据库验证AppId");

			Logger.verifyEquals(0, amount.compareTo(yae.getAvailAmount()), "数据库验证Availamount");
			Logger.verifyEquals(bizcode, yae.getBizCode(), "数据库验证Bizcode");
			Logger.verifyEquals(AccountingItems.get(0).getBizNo(), yae.getBizNo(), "数据库验证Bizcode");
			// 2 可用余额
			Logger.verifyEquals(2, yae.getEntryType(), "数据库验证Entrytype");
			Logger.verifyEquals(AccountingItems.get(0).getMemo(), yae.getMemo(), "数据库验证Memo");
			Logger.verifyEquals(oNo, yae.getOriginalNo(), "数据库验证Originalno");
			Logger.verifyEquals(Integer.valueOf(EnvSetup.getData("accountuid1")), yae.getUserId(), "数据库验证Userid");
			Logger.comment("验证金额");
			Account accountmap = new AccountWapper().selectAccountInfo(accountid1).get(0);
			BigDecimal fAvailAmount = new BigDecimal(accountmap.getAvailAmount().toString());
			BigDecimal fFreezeAmount = new BigDecimal(accountmap.getFreezeAmount().toString());
			Logger.verifyEquals(0, amount.compareTo(fAvailAmount), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fFreezeAmount), "数据库验证fFreezeAmount");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_016() {
		Logger.start(false, "锁定账户后进行单笔余额入账操作,操作失败");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(0), new BigDecimal(0));
			AccountCallServiceV2.lockAccountId(accountid1);
			BigDecimal amount = new BigDecimal(10);
			String appid = "AutoTest";
			int bizcode = 100001;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItems.add(AccountCallServiceV2.getFundinBean(accountid1, amount, bizcode, oNo));
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(ECode.ACCOUNT_DISABLE_CODE, accountingCall.getStatus(), "验证StatusCode");
			Logger.verifyIsContains(ECode.ACCOUNT_DISABLE, accountingCall.getMsg(), "验证Msg包含信息");
			Logger.comment("验证金额");
			Account accountmap = new AccountWapper().selectAccountInfo(accountid1).get(0);
			BigDecimal fAvailAmount = new BigDecimal(accountmap.getAvailAmount().toString());
			BigDecimal fFreezeAmount = new BigDecimal(accountmap.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fAvailAmount), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fFreezeAmount), "数据库验证fFreezeAmount");
			Logger.verifyEquals("1", accountmap.getStatus().toString(), "数据库验证iAction");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_017() {
		Logger.start(false, "锁定账户后进行单笔余额出账操作,操作失败");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(10), new BigDecimal(10));
			AccountCallServiceV2.lockAccountId(accountid1);
			BigDecimal amount = new BigDecimal(10);
			String appid = "AutoTest";
			int bizcode = 100001;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItems.add(AccountCallServiceV2.getFundoutBean(accountid1, amount, bizcode, oNo));
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(ECode.ACCOUNT_DISABLE_CODE, accountingCall.getStatus(), "验证StatusCode");
			Logger.verifyIsContains(ECode.ACCOUNT_DISABLE, accountingCall.getMsg(), "验证Msg包含信息");
			Logger.comment("验证金额");
			Account accountmap = new AccountWapper().selectAccountInfo(accountid1).get(0);
			BigDecimal fAvailAmount = new BigDecimal(accountmap.getAvailAmount().toString());
			BigDecimal fFreezeAmount = new BigDecimal(accountmap.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(10).compareTo(fAvailAmount), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(10).compareTo(fFreezeAmount), "数据库验证fFreezeAmount");
			Logger.verifyEquals("1", accountmap.getStatus().toString(), "数据库验证iAction");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_018() {
		Logger.start(false, "锁定账户后进行单笔冻结金额入账操作,操作失败");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(10), new BigDecimal(10));
			AccountCallServiceV2.lockAccountId(accountid1);
			BigDecimal amount = new BigDecimal(10);
			String appid = "AutoTest";
			int bizcode = 100001;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItems.add(AccountCallServiceV2.getFreezeBean(accountid1, amount, bizcode, oNo));
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(ECode.ACCOUNT_DISABLE_CODE, accountingCall.getStatus(), "验证StatusCode");
			Logger.verifyIsContains(ECode.ACCOUNT_DISABLE, accountingCall.getMsg(), "验证Msg包含信息");
			Logger.comment("验证金额");
			Account accountmap = new AccountWapper().selectAccountInfo(accountid1).get(0);
			BigDecimal fAvailAmount = new BigDecimal(accountmap.getAvailAmount().toString());
			BigDecimal fFreezeAmount = new BigDecimal(accountmap.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(10).compareTo(fAvailAmount), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(10).compareTo(fFreezeAmount), "数据库验证fFreezeAmount");
			Logger.verifyEquals("1", accountmap.getStatus().toString(), "数据库验证iAction");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_019() {
		Logger.start(false, "锁定账户后进行单笔冻结金额出账操作,操作失败");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(10), new BigDecimal(10));
			AccountCallServiceV2.lockAccountId(accountid1);
			BigDecimal amount = new BigDecimal(10);
			String appid = "AutoTest";
			int bizcode = 100001;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItems.add(AccountCallServiceV2.getUnfreezeBean(accountid1, amount, bizcode, oNo));
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(ECode.ACCOUNT_DISABLE_CODE, accountingCall.getStatus(), "验证StatusCode");
			Logger.verifyIsContains(ECode.ACCOUNT_DISABLE, accountingCall.getMsg(), "验证Msg包含信息");
			Logger.comment("验证金额");
			Account accountmap = new AccountWapper().selectAccountInfo(accountid1).get(0);
			BigDecimal fAvailAmount = new BigDecimal(accountmap.getAvailAmount().toString());
			BigDecimal fFreezeAmount = new BigDecimal(accountmap.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(10).compareTo(fAvailAmount), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(10).compareTo(fFreezeAmount), "数据库验证fFreezeAmount");
			Logger.verifyEquals("1", accountmap.getStatus().toString(), "数据库验证iAction");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_020() {
		Logger.start(false, "锁定账户后进行多笔操作,操作失败");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(10), new BigDecimal(10));
			AccountCallServiceV2.resetAccount(accountid2, new BigDecimal(10), new BigDecimal(10));
			AccountCallServiceV2.lockAccountId(accountid1);
			BigDecimal amount = new BigDecimal(10);
			String appid = "AutoTest";
			int bizcode = 100001;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItems.add(AccountCallServiceV2.getFundinBean(accountid1, amount, bizcode, oNo));
			AccountingItems.add(AccountCallServiceV2.getFundinBean(accountid2, amount, bizcode, oNo));
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(ECode.ACCOUNT_DISABLE_CODE, accountingCall.getStatus(), "验证StatusCode");
			Logger.verifyIsContains(ECode.ACCOUNT_DISABLE, accountingCall.getMsg(), "验证Msg包含信息");
			Logger.comment("验证金额：" + accountid1);
			Account accountmap = new AccountWapper().selectAccountInfo(accountid1).get(0);
			Logger.debug(accountmap);
			BigDecimal fAvailAmount = new BigDecimal(accountmap.getAvailAmount().toString());
			BigDecimal fFreezeAmount = new BigDecimal(accountmap.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(10).compareTo(fAvailAmount), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(10).compareTo(fFreezeAmount), "数据库验证fAvailAmount");
			Logger.verifyEquals("1", accountmap.getStatus().toString(), "数据库验证iAction");
			Logger.comment("验证金额：" + accountid2);
			Account accountmap2 = new AccountWapper().selectAccountInfo(accountid2).get(0);
			Logger.debug(accountmap2);
			fAvailAmount = new BigDecimal(accountmap2.getAvailAmount().toString());
			fFreezeAmount = new BigDecimal(accountmap2.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(10).compareTo(fAvailAmount), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(10).compareTo(fFreezeAmount), "数据库验证fFreezeAmount");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_021() {
		Logger.start(true, "执行单笔余额出账操作,单笔余额出账成功,验证余额和流水表数据");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(10), new BigDecimal(10));
			Logger.comment("单笔余额出账4元");
			BigDecimal amount = new BigDecimal(4);
			String appid = "AutoTest";
			int bizcode = 100001;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItems.add(AccountCallServiceV2.getFundoutBean(accountid1, amount, bizcode, oNo));
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(0, accountingCall.getStatus(), "验证StatusCode");
			Logger.comment("验证流水");
			AccountEntry yae = new AccountWapper().selectAccountEntry(accountid1, oNo).get(0);
			Logger.verifyEquals(accountid1, yae.getAccountId(), "数据库验证accountid");
			Logger.comment("验证单笔余额出账4元");
			Logger.verifyEquals(0, new BigDecimal(-4).compareTo(yae.getAmount()), "数据库验证发生金额amount");
			Logger.verifyEquals(appid, yae.getAppId(), "数据库验证AppId");
			Logger.comment("流水表验证剩余6元");
			Logger.verifyEquals(0, new BigDecimal(6).compareTo(yae.getAvailAmount()), "数据库验证Availamount");
			Logger.verifyEquals(bizcode, yae.getBizCode(), "数据库验证Bizcode");
			Logger.verifyEquals(AccountingItems.get(0).getBizNo(), yae.getBizNo(), "数据库验证Bizcode");
			// 2 可用余额
			Logger.verifyEquals(2, yae.getEntryType(), "数据库验证Entrytype");
			Logger.verifyEquals(AccountingItems.get(0).getMemo(), yae.getMemo(), "数据库验证Memo");
			Logger.verifyEquals(oNo, yae.getOriginalNo(), "数据库验证Originalno");
			Logger.verifyEquals(Integer.valueOf(EnvSetup.getData("accountuid1")), yae.getUserId(), "数据库验证Userid");
			Logger.comment("验证金额");
			Account accountmap = new AccountWapper().selectAccountInfo(accountid1).get(0);
			BigDecimal fAvailAmount = new BigDecimal(accountmap.getAvailAmount().toString());
			BigDecimal fFreezeAmount = new BigDecimal(accountmap.getFreezeAmount().toString());
			Logger.comment("验证剩余6元");
			Logger.verifyEquals(0, new BigDecimal(6).compareTo(fAvailAmount), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(10).compareTo(fFreezeAmount), "数据库验证fFreezeAmount");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_022() {
		Logger.start(false, "可用余额不足执行单笔余额出账操作,单笔余额出账失败");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(10), new BigDecimal(10));
			BigDecimal amount = new BigDecimal(12);
			String appid = "AutoTest";
			int bizcode = 100001;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItems.add(AccountCallServiceV2.getFundoutBean(accountid1, amount, bizcode, oNo));
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(ECode.BALANCES_INSUFFICIENT_CODE, accountingCall.getStatus(), "验证StatusCode");
			Logger.verifyIsContains(ECode.BALANCES_INSUFFICIENT, accountingCall.getMsg(), "验证Msg包含信息");
			Logger.comment("验证金额");
			Account accountmap = new AccountWapper().selectAccountInfo(accountid1).get(0);
			BigDecimal fAvailAmount = new BigDecimal(accountmap.getAvailAmount().toString());
			BigDecimal fFreezeAmount = new BigDecimal(accountmap.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(10).compareTo(fAvailAmount), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(10).compareTo(fFreezeAmount), "数据库验证fFreezeAmount");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_023() {
		Logger.start(true, "单笔冻结金额入账操作,操作成功,验证冻结金额入账余额增加和流水表数据");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(10), new BigDecimal(10));
			Logger.comment("冻结增加4元");
			BigDecimal amount = new BigDecimal(4);
			String appid = "AutoTest";
			int bizcode = 100001;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItems.add(AccountCallServiceV2.getFreezeBean(accountid1, amount, bizcode, oNo));
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(0, accountingCall.getStatus(), "验证StatusCode");
			Logger.comment("验证流水");
			AccountEntry yae = new AccountWapper().selectAccountEntry(accountid1, oNo).get(0);
			Logger.verifyEquals(accountid1, yae.getAccountId(), "数据库验证accountid");
			Logger.verifyEquals(0, new BigDecimal(4).compareTo(yae.getAmount()), "数据库验证发生金额amount");
			Logger.verifyEquals(appid, yae.getAppId(), "数据库验证AppId");
			Logger.verifyEquals(0, new BigDecimal(10).compareTo(yae.getAvailAmount()), "数据库验证Availamount");
			Logger.verifyEquals(0, new BigDecimal(14).compareTo(yae.getFreezeAmount()), "数据库验证Freezeamount");
			Logger.verifyEquals(bizcode, yae.getBizCode(), "数据库验证Bizcode");
			Logger.verifyEquals(AccountingItems.get(0).getBizNo(), yae.getBizNo(), "数据库验证Bizcode");
			// 1 冻结金额
			Logger.verifyEquals(1, yae.getEntryType(), "数据库验证Entrytype");
			Logger.verifyEquals(AccountingItems.get(0).getMemo(), yae.getMemo(), "数据库验证Memo");
			Logger.verifyEquals(oNo, yae.getOriginalNo(), "数据库验证Originalno");
			Logger.verifyEquals(Integer.valueOf(EnvSetup.getData("accountuid1")), yae.getUserId(), "数据库验证Userid");
			Logger.comment("验证金额");
			Account accountmap = new AccountWapper().selectAccountInfo(accountid1).get(0);
			BigDecimal fAvailAmount = new BigDecimal(accountmap.getAvailAmount().toString());
			BigDecimal fFreezeAmount = new BigDecimal(accountmap.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(10).compareTo(fAvailAmount), "数据库验证fAvailAmount");
			Logger.comment("验证冻结金额14元");
			Logger.verifyEquals(0, new BigDecimal(14).compareTo(fFreezeAmount), "数据库验证fFreezeAmount");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_024() {
		Logger.start(true, "单笔冻结金额出账金额为全部冻结金额,操作成功,验证冻结金额减少和流水表数据");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(10), new BigDecimal(10));
			Logger.comment("冻结减少10元");
			BigDecimal amount = new BigDecimal(10);
			String appid = "AutoTest";
			int bizcode = 100001;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItems.add(AccountCallServiceV2.getUnfreezeBean(accountid1, amount, bizcode, oNo));
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(0, accountingCall.getStatus(), "验证StatusCode");
			Logger.comment("验证流水");
			AccountEntry yae = new AccountWapper().selectAccountEntry(accountid1, oNo).get(0);
			Logger.verifyEquals(accountid1, yae.getAccountId(), "数据库验证accountid");
			Logger.verifyEquals(0, new BigDecimal(-10).compareTo(yae.getAmount()), "数据库验证发生金额amount");
			Logger.verifyEquals(appid, yae.getAppId(), "数据库验证AppId");
			Logger.verifyEquals(0, new BigDecimal(10).compareTo(yae.getAvailAmount()), "数据库验证Availamount");
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(yae.getFreezeAmount()), "数据库验证Freezeamount");
			Logger.verifyEquals(bizcode, yae.getBizCode(), "数据库验证Bizcode");
			Logger.verifyEquals(AccountingItems.get(0).getBizNo(), yae.getBizNo(), "数据库验证Bizcode");
			// 1 冻结金额
			Logger.verifyEquals(1, yae.getEntryType(), "数据库验证Entrytype");
			Logger.verifyEquals(AccountingItems.get(0).getMemo(), yae.getMemo(), "数据库验证Memo");
			Logger.verifyEquals(oNo, yae.getOriginalNo(), "数据库验证Originalno");
			Logger.verifyEquals(Integer.valueOf(EnvSetup.getData("accountuid1")), yae.getUserId(), "数据库验证Userid");
			Logger.comment("验证金额");
			Account accountmap = new AccountWapper().selectAccountInfo(accountid1).get(0);
			BigDecimal fAvailAmount = new BigDecimal(accountmap.getAvailAmount().toString());
			BigDecimal fFreezeAmount = new BigDecimal(accountmap.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(10).compareTo(fAvailAmount), "数据库验证fAvailAmount");
			Logger.comment("验证冻结金额0元");
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fFreezeAmount), "数据库验证fFreezeAmount");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_025() {
		Logger.start(false, "单笔冻结金额出账金额超出冻结金额入账余额,操作失败,验证流水表不增加数据冻结金额入账金额不变");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(10), new BigDecimal(10));
			BigDecimal amount = new BigDecimal(11);
			String appid = "AutoTest";
			int bizcode = 100001;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItems.add(AccountCallServiceV2.getUnfreezeBean(accountid1, amount, bizcode, oNo));
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(ECode.FREEZE_INSUFFICIENT_CODE, accountingCall.getStatus(), "验证StatusCode");
			Logger.verifyIsContains(ECode.FREEZE_INSUFFICIENT, accountingCall.getMsg(), "验证Msg包含信息");
			Logger.comment("验证金额");
			Account accountmap = new AccountWapper().selectAccountInfo(accountid1).get(0);
			BigDecimal fAvailAmount = new BigDecimal(accountmap.getAvailAmount().toString());
			BigDecimal fFreezeAmount = new BigDecimal(accountmap.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(10).compareTo(fAvailAmount), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(10).compareTo(fFreezeAmount), "数据库验证fFreezeAmount");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_026() {
		Logger.start(true, "单账户冻结金额减少余额增加,操作成功(场景确认收货),验证余额和流水表数据");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(0), new BigDecimal(10));
			BigDecimal fundinamount = new BigDecimal(6);
			BigDecimal unfreezeamount = new BigDecimal(6);
			String appid = "AutoTest";
			// bizcode 结算
			int bizcode = 300004;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItems.add(AccountCallServiceV2.getUnfreezeBean(accountid1, unfreezeamount, bizcode, oNo));
			AccountingItems.add(AccountCallServiceV2.getFundinBean(accountid1, fundinamount, bizcode, oNo));
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(0, accountingCall.getStatus(), "验证StatusCode");
			Logger.comment("验证流水");
			List<AccountEntry> aelist = new AccountWapper().selectAccountEntry(accountid1, oNo);
			Logger.verifyEquals(AccountingItems.size(), aelist.size(), "验证流水记录条数");
			int i = 0;
			for (AccountEntry yae : aelist) {
				AccountingItemBean accountingitem = AccountingItems.get(i);
				Map m = getAccountInfoByAccounting(accountingitem);
				Logger.verifyEquals(accountingitem.getAccountId(), yae.getAccountId(), "数据库验证accountid");
				Logger.verifyEquals(appid, yae.getAppId(), "数据库验证AppId");
				Logger.debug(yae.getAmount());
				Logger.debug((BigDecimal) m.get("amount"));
				Logger.verifyEquals(0, yae.getAmount().compareTo(((BigDecimal) m.get("amount"))), "数据库验证发生金额是否正确");
				// "数据库验证Availamount");
				Logger.verifyEquals(accountingitem.getBizCode(), yae.getBizCode(), "数据库验证Bizcode");
				Logger.verifyEquals(accountingitem.getBizNo(), yae.getBizNo(), "数据库验证Bizcode");
				// 2 可用余额
				Logger.verifyEquals(m.get("Entrytype"), yae.getEntryType(), "数据库验证Entrytype");
				Logger.verifyEquals(AccountingItems.get(i).getMemo(), yae.getMemo(), "数据库验证Memo");
				Logger.verifyEquals(oNo, yae.getOriginalNo(), "数据库验证Originalno");
				Logger.verifyEquals(Integer.valueOf(EnvSetup.getData("accountuid1")), yae.getUserId(), "数据库验证Userid");
				i++;
			}

			Logger.comment("验证金额" + accountid1);
			Account accountmap = new AccountWapper().selectAccountInfo(accountid1).get(0);
			BigDecimal fAvailAmount = new BigDecimal(accountmap.getAvailAmount().toString());
			BigDecimal fFreezeAmount = new BigDecimal(accountmap.getFreezeAmount().toString());
			Logger.verifyEquals(0, fundinamount.compareTo(fAvailAmount), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(4).compareTo(fFreezeAmount), "数据库验证fFreezeAmount");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_027() {
		Logger.start(false, "单账户冻结金额金额减少余额增加时冻结金额不足,操作失败,验证流水表不增加数据");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(1), new BigDecimal(1));
			BigDecimal fundinamount = new BigDecimal(6);
			BigDecimal unfreezeamount = new BigDecimal(6);
			String appid = "AutoTest";
			int bizcode = 300004;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItems.add(AccountCallServiceV2.getUnfreezeBean(accountid1, unfreezeamount, bizcode, oNo));
			AccountingItems.add(AccountCallServiceV2.getFundinBean(accountid1, fundinamount, bizcode, oNo));
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(ECode.FREEZE_INSUFFICIENT_CODE, accountingCall.getStatus(), "验证StatusCode");
			Logger.verifyIsContains(ECode.FREEZE_INSUFFICIENT, accountingCall.getMsg(), "验证Msg包含信息");
			Logger.comment("验证金额" + accountid1);
			Account accountmap = new AccountWapper().selectAccountInfo(accountid1).get(0);
			BigDecimal fAvailAmount = new BigDecimal(accountmap.getAvailAmount().toString());
			BigDecimal fFreezeAmount = new BigDecimal(accountmap.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(1).compareTo(fAvailAmount), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(1).compareTo(fFreezeAmount), "数据库验证fFreezeAmount");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_028() {
		Logger.start(true, "账户1余额增加账户2冻结金额减少,操作成功(场景取消订单),验证余额和流水表数据");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(0), new BigDecimal(0));
			AccountCallServiceV2.resetAccount(accountid2, new BigDecimal(0), new BigDecimal(10));
			BigDecimal fundinamount = new BigDecimal(6);
			BigDecimal unfreezeamount = new BigDecimal(6);
			String appid = "AutoTest";
			// bizcode 取消订单
			int bizcode = 300005;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItems.add(AccountCallServiceV2.getFundinBean(accountid1, fundinamount, bizcode, oNo));
			AccountingItems.add(AccountCallServiceV2.getUnfreezeBean(accountid2, unfreezeamount, bizcode, oNo));
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(0, accountingCall.getStatus(), "验证StatusCode");
			List<AccountEntry> aelist = new AccountWapper().selectAccountEntry(accountid1, oNo);
			AccountEntry yae = aelist.get(0);
			List<AccountEntry> aelist2 = new AccountWapper().selectAccountEntry(accountid2, oNo);
			AccountEntry yae2 = aelist2.get(0);
			Logger.verifyEquals(1, aelist.size(), accountid1 + "验证流水记录条数");
			Logger.verifyEquals(1, aelist2.size(), accountid2 + "验证流水记录条数");
			Logger.comment(accountid1 + "流水验证");
			AccountingItemBean accountingitem = AccountingItems.get(0);
			Map m = getAccountInfoByAccounting(accountingitem);
			Logger.verifyEquals(accountingitem.getAccountId(), yae.getAccountId(), "数据库验证accountid");
			Logger.verifyEquals(appid, yae.getAppId(), "数据库验证AppId");
			Logger.debug(yae.getAmount());
			Logger.debug((BigDecimal) m.get("amount"));
			Logger.verifyEquals(0, yae.getAmount().compareTo(((BigDecimal) m.get("amount"))), "数据库验证发生金额是否正确");
			// "数据库验证Availamount");
			Logger.verifyEquals(accountingitem.getBizCode(), yae.getBizCode(), "数据库验证Bizcode");
			Logger.verifyEquals(accountingitem.getBizNo(), yae.getBizNo(), "数据库验证Bizcode");
			// 2 可用余额
			Logger.verifyEquals(m.get("Entrytype"), yae.getEntryType(), "数据库验证Entrytype");
			Logger.verifyEquals(AccountingItems.get(0).getMemo(), yae.getMemo(), "数据库验证Memo");
			Logger.verifyEquals(oNo, yae.getOriginalNo(), "数据库验证Originalno");
			Logger.verifyEquals(Integer.valueOf(EnvSetup.getData("accountuid1")), yae.getUserId(), "数据库验证Userid");
			Logger.comment(accountid2 + "流水验证");
			AccountingItemBean accountingitem2 = AccountingItems.get(1);
			Map m2 = getAccountInfoByAccounting(accountingitem2);
			Logger.verifyEquals(accountingitem2.getAccountId(), yae2.getAccountId(), "数据库验证accountid");
			Logger.verifyEquals(appid, yae2.getAppId(), "数据库验证AppId");
			Logger.debug(yae2.getAmount());
			Logger.debug((BigDecimal) m2.get("amount"));
			Logger.verifyEquals(0, yae2.getAmount().compareTo(((BigDecimal) m2.get("amount"))), "数据库验证发生金额是否正确");
			// "数据库验证Availamount");
			Logger.verifyEquals(accountingitem2.getBizCode(), yae2.getBizCode(), "数据库验证Bizcode");
			Logger.verifyEquals(accountingitem2.getBizNo(), yae2.getBizNo(), "数据库验证Bizcode");
			// 2 可用余额
			Logger.verifyEquals(m2.get("Entrytype"), yae2.getEntryType(), "数据库验证Entrytype");
			Logger.verifyEquals(AccountingItems.get(1).getMemo(), yae2.getMemo(), "数据库验证Memo");
			Logger.verifyEquals(oNo, yae2.getOriginalNo(), "数据库验证Originalno");
			Logger.verifyEquals(Integer.valueOf(EnvSetup.getData("accountuid2")), yae2.getUserId(), "数据库验证Userid");
			Logger.comment("验证金额" + accountid1);
			Account accountmap = new AccountWapper().selectAccountInfo(accountid1).get(0);
			BigDecimal fAvailAmount = new BigDecimal(accountmap.getAvailAmount().toString());
			BigDecimal fFreezeAmount = new BigDecimal(accountmap.getFreezeAmount().toString());
			Logger.verifyEquals(0, fundinamount.compareTo(fAvailAmount), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fFreezeAmount), "数据库验证fFreezeAmount");

			Logger.comment("验证金额" + accountid2);
			Account accountmap2 = new AccountWapper().selectAccountInfo(accountid2).get(0);
			BigDecimal fAvailAmount2 = new BigDecimal(accountmap2.getAvailAmount().toString());
			BigDecimal fFreezeAmount2 = new BigDecimal(accountmap2.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fAvailAmount2), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(4).compareTo(fFreezeAmount2), "数据库验证fFreezeAmount");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_029() {
		Logger.start(false, "账户1余额增加账户2冻结金额减少时账户2冻结金额不足,操作失败,验证流水表不增加数据");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(1), new BigDecimal(1));
			AccountCallServiceV2.resetAccount(accountid2, new BigDecimal(2), new BigDecimal(2));
			BigDecimal fundinamount = new BigDecimal(6);
			BigDecimal unfreezeamount = new BigDecimal(6);
			String appid = "AutoTest";
			int bizcode = 300004;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItems.add(AccountCallServiceV2.getFundinBean(accountid1, fundinamount, bizcode, oNo));
			AccountingItems.add(AccountCallServiceV2.getUnfreezeBean(accountid2, unfreezeamount, bizcode, oNo));
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(ECode.FREEZE_INSUFFICIENT_CODE, accountingCall.getStatus(), "验证StatusCode");
			Logger.verifyIsContains(ECode.FREEZE_INSUFFICIENT, accountingCall.getMsg(), "验证Msg包含信息");
			Logger.comment("验证金额" + accountid1);
			Account accountmap = new AccountWapper().selectAccountInfo(accountid1).get(0);
			BigDecimal fAvailAmount = new BigDecimal(accountmap.getAvailAmount().toString());
			BigDecimal fFreezeAmount = new BigDecimal(accountmap.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(1).compareTo(fAvailAmount), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(1).compareTo(fFreezeAmount), "数据库验证fFreezeAmount");
			Logger.comment("验证金额" + accountid2);
			Account accountmap2 = new AccountWapper().selectAccountInfo(accountid2).get(0);
			BigDecimal fAvailAmount2 = new BigDecimal(accountmap2.getAvailAmount().toString());
			BigDecimal fFreezeAmount2 = new BigDecimal(accountmap2.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(2).compareTo(fAvailAmount2), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(2).compareTo(fFreezeAmount2), "数据库验证fFreezeAmount");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_030() {
		Logger.start(true, "账户1余额增加账户2余额减少,操作成功(场景退款),验证余额和流水表数据");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(0), new BigDecimal(0));
			AccountCallServiceV2.resetAccount(accountid2, new BigDecimal(10), new BigDecimal(0));
			BigDecimal fundinamount = new BigDecimal(6);
			BigDecimal fundoutamount = new BigDecimal(6);
			String appid = "AutoTest";
			// bizcode 退款
			int bizcode = 300006;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItems.add(AccountCallServiceV2.getFundinBean(accountid1, fundinamount, bizcode, oNo));
			AccountingItems.add(AccountCallServiceV2.getFundoutBean(accountid2, fundoutamount, bizcode, oNo));
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(0, accountingCall.getStatus(), "验证StatusCode");
			List<AccountEntry> aelist = new AccountWapper().selectAccountEntry(accountid1, oNo);
			AccountEntry yae = aelist.get(0);
			List<AccountEntry> aelist2 = new AccountWapper().selectAccountEntry(accountid2, oNo);
			AccountEntry yae2 = aelist2.get(0);
			Logger.verifyEquals(1, aelist.size(), accountid1 + "验证流水记录条数");
			Logger.verifyEquals(1, aelist2.size(), accountid2 + "验证流水记录条数");
			Logger.comment(accountid1 + "流水验证");
			AccountingItemBean accountingitem = AccountingItems.get(0);
			Map m = getAccountInfoByAccounting(accountingitem);
			Logger.verifyEquals(accountingitem.getAccountId(), yae.getAccountId(), "数据库验证accountid");
			Logger.verifyEquals(appid, yae.getAppId(), "数据库验证AppId");
			Logger.debug(yae.getAmount());
			Logger.debug((BigDecimal) m.get("amount"));
			Logger.verifyEquals(0, yae.getAmount().compareTo(((BigDecimal) m.get("amount"))), "数据库验证发生金额是否正确");
			// "数据库验证Availamount");
			Logger.verifyEquals(accountingitem.getBizCode(), yae.getBizCode(), "数据库验证Bizcode");
			Logger.verifyEquals(accountingitem.getBizNo(), yae.getBizNo(), "数据库验证Bizcode");
			// 2 可用余额
			Logger.verifyEquals(m.get("Entrytype"), yae.getEntryType(), "数据库验证Entrytype");
			Logger.verifyEquals(AccountingItems.get(0).getMemo(), yae.getMemo(), "数据库验证Memo");
			Logger.verifyEquals(oNo, yae.getOriginalNo(), "数据库验证Originalno");
			Logger.verifyEquals(Integer.valueOf(EnvSetup.getData("accountuid1")), yae.getUserId(), "数据库验证Userid");
			Logger.comment(accountid2 + "流水验证");
			AccountingItemBean accountingitem2 = AccountingItems.get(1);
			Map m2 = getAccountInfoByAccounting(accountingitem2);
			Logger.verifyEquals(accountingitem2.getAccountId(), yae2.getAccountId(), "数据库验证accountid");
			Logger.verifyEquals(appid, yae2.getAppId(), "数据库验证AppId");
			Logger.debug(yae2.getAmount());
			Logger.debug((BigDecimal) m2.get("amount"));
			Logger.verifyEquals(0, yae2.getAmount().compareTo(((BigDecimal) m2.get("amount"))), "数据库验证发生金额是否正确");
			// "数据库验证Availamount");
			Logger.verifyEquals(accountingitem2.getBizCode(), yae2.getBizCode(), "数据库验证Bizcode");
			Logger.verifyEquals(accountingitem2.getBizNo(), yae2.getBizNo(), "数据库验证Bizcode");
			// 2 可用余额
			Logger.verifyEquals(m2.get("Entrytype"), yae2.getEntryType(), "数据库验证Entrytype");
			Logger.verifyEquals(AccountingItems.get(1).getMemo(), yae2.getMemo(), "数据库验证Memo");
			Logger.verifyEquals(oNo, yae2.getOriginalNo(), "数据库验证Originalno");
			Logger.verifyEquals(Integer.valueOf(EnvSetup.getData("accountuid2")), yae2.getUserId(), "数据库验证Userid");
			Logger.comment("验证金额" + accountid1);
			Account accountmap = new AccountWapper().selectAccountInfo(accountid1).get(0);
			BigDecimal fAvailAmount = new BigDecimal(accountmap.getAvailAmount().toString());
			BigDecimal fFreezeAmount = new BigDecimal(accountmap.getFreezeAmount().toString());
			Logger.verifyEquals(0, fundinamount.compareTo(fAvailAmount), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fFreezeAmount), "数据库验证fFreezeAmount");

			Logger.comment("验证金额" + accountid2);
			Account accountmap2 = new AccountWapper().selectAccountInfo(accountid2).get(0);
			BigDecimal fAvailAmount2 = new BigDecimal(accountmap2.getAvailAmount().toString());
			BigDecimal fFreezeAmount2 = new BigDecimal(accountmap2.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(4).compareTo(fAvailAmount2), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fFreezeAmount2), "数据库验证fFreezeAmount");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_031() {
		Logger.start(false, "账户1余额增加账户2余额减少时账户2余额金额不足,操作失败,验证流水表不增加数据余额不变");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(0), new BigDecimal(0));
			AccountCallServiceV2.resetAccount(accountid2, new BigDecimal(1), new BigDecimal(0));
			BigDecimal fundinamount = new BigDecimal(6);
			BigDecimal fundoutamount = new BigDecimal(6);
			String appid = "AutoTest";
			// bizcode 退款
			int bizcode = 300006;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItems.add(AccountCallServiceV2.getFundinBean(accountid1, fundinamount, bizcode, oNo));
			AccountingItems.add(AccountCallServiceV2.getFundoutBean(accountid2, fundoutamount, bizcode, oNo));
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(ECode.BALANCES_INSUFFICIENT_CODE, accountingCall.getStatus(), "验证StatusCode");
			Logger.verifyIsContains(ECode.BALANCES_INSUFFICIENT, accountingCall.getMsg(), "验证Msg包含信息");
			Logger.comment("验证金额" + accountid1);
			Account accountmap = new AccountWapper().selectAccountInfo(accountid1).get(0);
			BigDecimal fAvailAmount = new BigDecimal(accountmap.getAvailAmount().toString());
			BigDecimal fFreezeAmount = new BigDecimal(accountmap.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fAvailAmount), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fFreezeAmount), "数据库验证fFreezeAmount");

			Logger.comment("验证金额" + accountid2);
			Account accountmap2 = new AccountWapper().selectAccountInfo(accountid2).get(0);
			BigDecimal fAvailAmount2 = new BigDecimal(accountmap2.getAvailAmount().toString());
			BigDecimal fFreezeAmount2 = new BigDecimal(accountmap2.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(1).compareTo(fAvailAmount2), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fFreezeAmount2), "数据库验证fFreezeAmount");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_032() {
		Logger.start(true, "账户1余额减少账户2冻结金额增加,操作成功(场景Ymatou余额支付),验证余额和流水表数据");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(10), new BigDecimal(0));
			AccountCallServiceV2.resetAccount(accountid2, new BigDecimal(0), new BigDecimal(0));
			BigDecimal fundoutamount = new BigDecimal(6);
			BigDecimal freezeamount = new BigDecimal(6);
			String appid = "AutoTest";
			// bizcode 付款
			int bizcode = 300001;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItems.add(AccountCallServiceV2.getFundoutBean(accountid1, fundoutamount, bizcode, oNo));
			AccountingItems.add(AccountCallServiceV2.getFreezeBean(accountid2, freezeamount, bizcode, oNo));
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(0, accountingCall.getStatus(), "验证StatusCode");
			List<AccountEntry> aelist = new AccountWapper().selectAccountEntry(accountid1, oNo);
			AccountEntry yae = aelist.get(0);
			List<AccountEntry> aelist2 = new AccountWapper().selectAccountEntry(accountid2, oNo);
			AccountEntry yae2 = aelist2.get(0);
			Logger.verifyEquals(1, aelist.size(), accountid1 + "验证流水记录条数");
			Logger.verifyEquals(1, aelist2.size(), accountid2 + "验证流水记录条数");
			Logger.comment(accountid1 + "流水验证");
			AccountingItemBean accountingitem = AccountingItems.get(0);
			Map m = getAccountInfoByAccounting(accountingitem);
			Logger.verifyEquals(accountingitem.getAccountId(), yae.getAccountId(), "数据库验证accountid");
			Logger.verifyEquals(appid, yae.getAppId(), "数据库验证AppId");
			Logger.debug(yae.getAmount());
			Logger.debug((BigDecimal) m.get("amount"));
			Logger.verifyEquals(0, yae.getAmount().compareTo(((BigDecimal) m.get("amount"))), "数据库验证发生金额是否正确");
			// "数据库验证Availamount");
			Logger.verifyEquals(accountingitem.getBizCode(), yae.getBizCode(), "数据库验证Bizcode");
			Logger.verifyEquals(accountingitem.getBizNo(), yae.getBizNo(), "数据库验证Bizcode");
			// 2 可用余额
			Logger.verifyEquals(m.get("Entrytype"), yae.getEntryType(), "数据库验证Entrytype");
			Logger.verifyEquals(AccountingItems.get(0).getMemo(), yae.getMemo(), "数据库验证Memo");
			Logger.verifyEquals(oNo, yae.getOriginalNo(), "数据库验证Originalno");
			Logger.verifyEquals(Integer.valueOf(EnvSetup.getData("accountuid1")), yae.getUserId(), "数据库验证Userid");
			Logger.comment(accountid2 + "流水验证");
			AccountingItemBean accountingitem2 = AccountingItems.get(1);
			Map m2 = getAccountInfoByAccounting(accountingitem2);
			Logger.verifyEquals(accountingitem2.getAccountId(), yae2.getAccountId(), "数据库验证accountid");
			Logger.verifyEquals(appid, yae2.getAppId(), "数据库验证AppId");
			Logger.debug(yae2.getAmount());
			Logger.debug((BigDecimal) m2.get("amount"));
			Logger.verifyEquals(0, yae2.getAmount().compareTo(((BigDecimal) m2.get("amount"))), "数据库验证发生金额是否正确");
			// "数据库验证Availamount");
			Logger.verifyEquals(accountingitem2.getBizCode(), yae2.getBizCode(), "数据库验证Bizcode");
			Logger.verifyEquals(accountingitem2.getBizNo(), yae2.getBizNo(), "数据库验证Bizcode");
			// 2 可用余额
			Logger.verifyEquals(m2.get("Entrytype"), yae2.getEntryType(), "数据库验证Entrytype");
			Logger.verifyEquals(AccountingItems.get(1).getMemo(), yae2.getMemo(), "数据库验证Memo");
			Logger.verifyEquals(oNo, yae2.getOriginalNo(), "数据库验证Originalno");
			Logger.verifyEquals(Integer.valueOf(EnvSetup.getData("accountuid2")), yae2.getUserId(), "数据库验证Userid");
			Logger.comment("验证金额" + accountid1);
			Account accountmap = new AccountWapper().selectAccountInfo(accountid1).get(0);
			BigDecimal fAvailAmount = new BigDecimal(accountmap.getAvailAmount().toString());
			BigDecimal fFreezeAmount = new BigDecimal(accountmap.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(4).compareTo(fAvailAmount), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fFreezeAmount), "数据库验证fFreezeAmount");

			Logger.comment("验证金额" + accountid2);
			Account accountmap2 = new AccountWapper().selectAccountInfo(accountid2).get(0);
			BigDecimal fAvailAmount2 = new BigDecimal(accountmap2.getAvailAmount().toString());
			BigDecimal fFreezeAmount2 = new BigDecimal(accountmap2.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fAvailAmount2), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(6).compareTo(fFreezeAmount2), "数据库验证fFreezeAmount");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_033() {
		Logger.start(false, "账户2冻结金额增加账户1余额减少时账户1余额不足,操作失败,验证流水表不增加数据");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(1), new BigDecimal(0));
			AccountCallServiceV2.resetAccount(accountid2, new BigDecimal(0), new BigDecimal(0));
			BigDecimal fundoutamount = new BigDecimal(6);
			BigDecimal freezeamount = new BigDecimal(6);
			String appid = "AutoTest";
			// bizcode 付款
			int bizcode = 300001;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItems.add(AccountCallServiceV2.getFreezeBean(accountid2, freezeamount, bizcode, oNo));
			AccountingItems.add(AccountCallServiceV2.getFundoutBean(accountid1, fundoutamount, bizcode, oNo));
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(ECode.BALANCES_INSUFFICIENT_CODE, accountingCall.getStatus(), "验证StatusCode");
			Logger.verifyIsContains(ECode.BALANCES_INSUFFICIENT, accountingCall.getMsg(), "验证Msg包含信息");
			Logger.comment("验证金额" + accountid1);
			Account accountmap = new AccountWapper().selectAccountInfo(accountid1).get(0);
			BigDecimal fAvailAmount = new BigDecimal(accountmap.getAvailAmount().toString());
			BigDecimal fFreezeAmount = new BigDecimal(accountmap.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(1).compareTo(fAvailAmount), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fFreezeAmount), "数据库验证fFreezeAmount");

			Logger.comment("验证金额" + accountid2);
			Account accountmap2 = new AccountWapper().selectAccountInfo(accountid2).get(0);
			BigDecimal fAvailAmount2 = new BigDecimal(accountmap2.getAvailAmount().toString());
			BigDecimal fFreezeAmount2 = new BigDecimal(accountmap2.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fAvailAmount2), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fFreezeAmount2), "数据库验证fFreezeAmount");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_034() {
		Logger.start(true, "账户1冻结金额减少账户2冻结金额增加,操作成功(场景暂无),验证余额和流水表数据");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(0), new BigDecimal(10));
			AccountCallServiceV2.resetAccount(accountid2, new BigDecimal(0), new BigDecimal(0));
			BigDecimal unfreezeamount = new BigDecimal(6);
			BigDecimal freezeamount = new BigDecimal(6);
			String appid = "AutoTest";
			// bizcode 假装用佣金bizcode 暂无
			int bizcode = 300008;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItems.add(AccountCallServiceV2.getUnfreezeBean(accountid1, unfreezeamount, bizcode, oNo));
			AccountingItems.add(AccountCallServiceV2.getFreezeBean(accountid2, freezeamount, bizcode, oNo));
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(0, accountingCall.getStatus(), "验证StatusCode");
			List<AccountEntry> aelist = new AccountWapper().selectAccountEntry(accountid1, oNo);
			AccountEntry yae = aelist.get(0);
			List<AccountEntry> aelist2 = new AccountWapper().selectAccountEntry(accountid2, oNo);
			AccountEntry yae2 = aelist2.get(0);
			Logger.verifyEquals(1, aelist.size(), accountid1 + "验证流水记录条数");
			Logger.verifyEquals(1, aelist2.size(), accountid2 + "验证流水记录条数");
			Logger.comment(accountid1 + "流水验证");
			AccountingItemBean accountingitem = AccountingItems.get(0);
			Map m = getAccountInfoByAccounting(accountingitem);
			Logger.verifyEquals(accountingitem.getAccountId(), yae.getAccountId(), "数据库验证accountid");
			Logger.verifyEquals(appid, yae.getAppId(), "数据库验证AppId");
			Logger.debug(yae.getAmount());
			Logger.debug((BigDecimal) m.get("amount"));
			Logger.verifyEquals(0, yae.getAmount().compareTo(((BigDecimal) m.get("amount"))), "数据库验证发生金额是否正确");
			// "数据库验证Availamount");
			Logger.verifyEquals(accountingitem.getBizCode(), yae.getBizCode(), "数据库验证Bizcode");
			Logger.verifyEquals(accountingitem.getBizNo(), yae.getBizNo(), "数据库验证Bizcode");
			// 2 可用余额
			Logger.verifyEquals(m.get("Entrytype"), yae.getEntryType(), "数据库验证Entrytype");
			Logger.verifyEquals(AccountingItems.get(0).getMemo(), yae.getMemo(), "数据库验证Memo");
			Logger.verifyEquals(oNo, yae.getOriginalNo(), "数据库验证Originalno");
			Logger.verifyEquals(Integer.valueOf(EnvSetup.getData("accountuid1")), yae.getUserId(), "数据库验证Userid");
			Logger.comment(accountid2 + "流水验证");
			AccountingItemBean accountingitem2 = AccountingItems.get(1);
			Map m2 = getAccountInfoByAccounting(accountingitem2);
			Logger.verifyEquals(accountingitem2.getAccountId(), yae2.getAccountId(), "数据库验证accountid");
			Logger.verifyEquals(appid, yae2.getAppId(), "数据库验证AppId");
			Logger.debug(yae2.getAmount());
			Logger.debug((BigDecimal) m2.get("amount"));
			Logger.verifyEquals(0, yae2.getAmount().compareTo(((BigDecimal) m2.get("amount"))), "数据库验证发生金额是否正确");
			// "数据库验证Availamount");
			Logger.verifyEquals(accountingitem2.getBizCode(), yae2.getBizCode(), "数据库验证Bizcode");
			Logger.verifyEquals(accountingitem2.getBizNo(), yae2.getBizNo(), "数据库验证Bizcode");
			// 2 可用余额
			Logger.verifyEquals(m2.get("Entrytype"), yae2.getEntryType(), "数据库验证Entrytype");
			Logger.verifyEquals(AccountingItems.get(1).getMemo(), yae2.getMemo(), "数据库验证Memo");
			Logger.verifyEquals(oNo, yae2.getOriginalNo(), "数据库验证Originalno");
			Logger.verifyEquals(Integer.valueOf(EnvSetup.getData("accountuid2")), yae2.getUserId(), "数据库验证Userid");
			Logger.comment("验证金额" + accountid1);
			Account accountmap = new AccountWapper().selectAccountInfo(accountid1).get(0);
			BigDecimal fAvailAmount = new BigDecimal(accountmap.getAvailAmount().toString());
			BigDecimal fFreezeAmount = new BigDecimal(accountmap.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fAvailAmount), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(4).compareTo(fFreezeAmount), "数据库验证fFreezeAmount");

			Logger.comment("验证金额" + accountid2);
			Account accountmap2 = new AccountWapper().selectAccountInfo(accountid2).get(0);
			BigDecimal fAvailAmount2 = new BigDecimal(accountmap2.getAvailAmount().toString());
			BigDecimal fFreezeAmount2 = new BigDecimal(accountmap2.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fAvailAmount2), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(6).compareTo(fFreezeAmount2), "数据库验证fFreezeAmount");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_035() {
		Logger.start(false, "账户2冻结金额增加账户1冻结金额减少时账户1冻结金额入账金额不足,操作失败,验证流水表不增加数据");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(1), new BigDecimal(0));
			AccountCallServiceV2.resetAccount(accountid2, new BigDecimal(0), new BigDecimal(0));
			BigDecimal unfreezeamount = new BigDecimal(6);
			BigDecimal freezeamount = new BigDecimal(6);
			String appid = "AutoTest";
			// bizcode 假装用佣金bizcode 暂无
			int bizcode = 300008;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItems.add(AccountCallServiceV2.getFreezeBean(accountid2, freezeamount, bizcode, oNo));
			AccountingItems.add(AccountCallServiceV2.getUnfreezeBean(accountid1, unfreezeamount, bizcode, oNo));
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(ECode.FREEZE_INSUFFICIENT_CODE, accountingCall.getStatus(), "验证StatusCode");
			Logger.verifyIsContains(ECode.FREEZE_INSUFFICIENT, accountingCall.getMsg(), "验证Msg包含信息");
			Logger.comment("验证金额" + accountid1);
			Account accountmap = new AccountWapper().selectAccountInfo(accountid1).get(0);
			BigDecimal fAvailAmount = new BigDecimal(accountmap.getAvailAmount().toString());
			BigDecimal fFreezeAmount = new BigDecimal(accountmap.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(1).compareTo(fAvailAmount), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fFreezeAmount), "数据库验证fFreezeAmount");

			Logger.comment("验证金额" + accountid2);
			Account accountmap2 = new AccountWapper().selectAccountInfo(accountid2).get(0);
			BigDecimal fAvailAmount2 = new BigDecimal(accountmap2.getAvailAmount().toString());
			BigDecimal fFreezeAmount2 = new BigDecimal(accountmap2.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fAvailAmount2), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fFreezeAmount2), "数据库验证fFreezeAmount");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_036() {
		Logger.start(true, "账户1余额增加账户2冻结金额增加账户3余额减少账户4冻结金额减少,操作成功(场景暂无),验证余额和流水表数据");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(0), new BigDecimal(0));
			AccountCallServiceV2.resetAccount(accountid2, new BigDecimal(0), new BigDecimal(0));
			AccountCallServiceV2.resetAccount(accountid3, new BigDecimal(10), new BigDecimal(0));
			AccountCallServiceV2.resetAccount(accountid4, new BigDecimal(0), new BigDecimal(10));
			BigDecimal fundin = new BigDecimal(6);
			BigDecimal freezeamount = new BigDecimal(6);
			BigDecimal unfreezeamount = new BigDecimal(6);
			BigDecimal fundout = new BigDecimal(6);
			String appid = "AutoTest";
			// bizcode 假装用佣金bizcode 暂无
			int bizcode = 300008;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItems.add(AccountCallServiceV2.getFundinBean(accountid1, fundin, bizcode, oNo));
			AccountingItems.add(AccountCallServiceV2.getFreezeBean(accountid2, freezeamount, bizcode, oNo));
			AccountingItems.add(AccountCallServiceV2.getFundoutBean(accountid3, unfreezeamount, bizcode, oNo));
			AccountingItems.add(AccountCallServiceV2.getUnfreezeBean(accountid4, fundout, bizcode, oNo));
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(0, accountingCall.getStatus(), "验证StatusCode");
			List<AccountEntry> aelist = new AccountWapper().selectAccountEntry(accountid1, oNo);
			AccountEntry yae = aelist.get(0);
			List<AccountEntry> aelist2 = new AccountWapper().selectAccountEntry(accountid2, oNo);
			AccountEntry yae2 = aelist2.get(0);
			List<AccountEntry> aelist3 = new AccountWapper().selectAccountEntry(accountid3, oNo);
			AccountEntry yae3 = aelist3.get(0);
			List<AccountEntry> aelist4 = new AccountWapper().selectAccountEntry(accountid4, oNo);
			AccountEntry yae4 = aelist4.get(0);
			Logger.verifyEquals(1, aelist.size(), accountid1 + "验证流水记录条数");
			Logger.verifyEquals(1, aelist2.size(), accountid2 + "验证流水记录条数");
			Logger.verifyEquals(1, aelist3.size(), accountid3 + "验证流水记录条数");
			Logger.verifyEquals(1, aelist4.size(), accountid4 + "验证流水记录条数");

			Logger.comment(accountid1 + "流水验证");
			AccountingItemBean accountingitem = AccountingItems.get(0);
			Map m = getAccountInfoByAccounting(accountingitem);
			Logger.verifyEquals(accountingitem.getAccountId(), yae.getAccountId(), "数据库验证accountid");
			Logger.verifyEquals(appid, yae.getAppId(), "数据库验证AppId");
			Logger.debug(yae.getAmount());
			Logger.debug((BigDecimal) m.get("amount"));
			Logger.verifyEquals(0, yae.getAmount().compareTo(((BigDecimal) m.get("amount"))), "数据库验证发生金额是否正确");
			// "数据库验证Availamount");
			Logger.verifyEquals(accountingitem.getBizCode(), yae.getBizCode(), "数据库验证Bizcode");
			Logger.verifyEquals(accountingitem.getBizNo(), yae.getBizNo(), "数据库验证Bizcode");
			// 2 可用余额
			Logger.verifyEquals(m.get("Entrytype"), yae.getEntryType(), "数据库验证Entrytype");
			Logger.verifyEquals(AccountingItems.get(0).getMemo(), yae.getMemo(), "数据库验证Memo");
			Logger.verifyEquals(oNo, yae.getOriginalNo(), "数据库验证Originalno");
			Logger.verifyEquals(Integer.valueOf(EnvSetup.getData("accountuid1")), yae.getUserId(), "数据库验证Userid");

			Logger.comment(accountid2 + "流水验证");
			AccountingItemBean accountingitem2 = AccountingItems.get(1);
			Map m2 = getAccountInfoByAccounting(accountingitem2);
			Logger.verifyEquals(accountingitem2.getAccountId(), yae2.getAccountId(), "数据库验证accountid");
			Logger.verifyEquals(appid, yae2.getAppId(), "数据库验证AppId");
			Logger.debug(yae2.getAmount());
			Logger.debug((BigDecimal) m2.get("amount"));
			Logger.verifyEquals(0, yae2.getAmount().compareTo(((BigDecimal) m2.get("amount"))), "数据库验证发生金额是否正确");
			// "数据库验证Availamount");
			Logger.verifyEquals(accountingitem2.getBizCode(), yae2.getBizCode(), "数据库验证Bizcode");
			Logger.verifyEquals(accountingitem2.getBizNo(), yae2.getBizNo(), "数据库验证Bizcode");
			// 2 可用余额
			Logger.verifyEquals(m2.get("Entrytype"), yae2.getEntryType(), "数据库验证Entrytype");
			Logger.verifyEquals(AccountingItems.get(1).getMemo(), yae2.getMemo(), "数据库验证Memo");
			Logger.verifyEquals(oNo, yae2.getOriginalNo(), "数据库验证Originalno");
			Logger.verifyEquals(Integer.valueOf(EnvSetup.getData("accountuid2")), yae2.getUserId(), "数据库验证Userid");

			Logger.comment(accountid3 + "流水验证");
			AccountingItemBean accountingitem3 = AccountingItems.get(2);
			Map m3 = getAccountInfoByAccounting(accountingitem3);
			Logger.verifyEquals(accountingitem3.getAccountId(), yae3.getAccountId(), "数据库验证accountid");
			Logger.verifyEquals(appid, yae3.getAppId(), "数据库验证AppId");
			Logger.debug(yae3.getAmount());
			Logger.debug((BigDecimal) m.get("amount"));
			Logger.verifyEquals(0, yae3.getAmount().compareTo(((BigDecimal) m3.get("amount"))), "数据库验证发生金额是否正确");
			// "数据库验证Availamount");
			Logger.verifyEquals(accountingitem3.getBizCode(), yae3.getBizCode(), "数据库验证Bizcode");
			Logger.verifyEquals(accountingitem3.getBizNo(), yae3.getBizNo(), "数据库验证Bizcode");
			// 2 可用余额
			Logger.verifyEquals(m3.get("Entrytype"), yae3.getEntryType(), "数据库验证Entrytype");
			Logger.verifyEquals(AccountingItems.get(2).getMemo(), yae3.getMemo(), "数据库验证Memo");
			Logger.verifyEquals(oNo, yae3.getOriginalNo(), "数据库验证Originalno");
			Logger.verifyEquals(Integer.valueOf(EnvSetup.getData("accountuid3")), yae3.getUserId(), "数据库验证Userid");

			Logger.comment(accountid4 + "流水验证");
			AccountingItemBean accountingitem4 = AccountingItems.get(3);
			Map m4 = getAccountInfoByAccounting(accountingitem4);
			Logger.verifyEquals(accountingitem4.getAccountId(), yae4.getAccountId(), "数据库验证accountid");
			Logger.verifyEquals(appid, yae4.getAppId(), "数据库验证AppId");
			Logger.debug(yae4.getAmount());
			Logger.debug((BigDecimal) m4.get("amount"));
			Logger.verifyEquals(0, yae4.getAmount().compareTo(((BigDecimal) m4.get("amount"))), "数据库验证发生金额是否正确");
			// "数据库验证Availamount");
			Logger.verifyEquals(accountingitem4.getBizCode(), yae4.getBizCode(), "数据库验证Bizcode");
			Logger.verifyEquals(accountingitem4.getBizNo(), yae4.getBizNo(), "数据库验证Bizcode");
			// 2 可用余额
			Logger.verifyEquals(m4.get("Entrytype"), yae4.getEntryType(), "数据库验证Entrytype");
			Logger.verifyEquals(AccountingItems.get(3).getMemo(), yae4.getMemo(), "数据库验证Memo");
			Logger.verifyEquals(oNo, yae4.getOriginalNo(), "数据库验证Originalno");
			Logger.verifyEquals(Integer.valueOf(EnvSetup.getData("accountuid4")), yae4.getUserId(), "数据库验证Userid");

			Logger.comment("验证金额" + accountid1);
			Account accountmap = new AccountWapper().selectAccountInfo(accountid1).get(0);
			BigDecimal fAvailAmount = new BigDecimal(accountmap.getAvailAmount().toString());
			BigDecimal fFreezeAmount = new BigDecimal(accountmap.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(6).compareTo(fAvailAmount), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fFreezeAmount), "数据库验证fFreezeAmount");

			Logger.comment("验证金额" + accountid2);
			Account accountmap2 = new AccountWapper().selectAccountInfo(accountid2).get(0);
			BigDecimal fAvailAmount2 = new BigDecimal(accountmap2.getAvailAmount().toString());
			BigDecimal fFreezeAmount2 = new BigDecimal(accountmap2.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fAvailAmount2), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(6).compareTo(fFreezeAmount2), "数据库验证fFreezeAmount");

			Logger.comment("验证金额" + accountid3);
			Account accountmap3 = new AccountWapper().selectAccountInfo(accountid3).get(0);
			BigDecimal fAvailAmount3 = new BigDecimal(accountmap3.getAvailAmount().toString());
			BigDecimal fFreezeAmount3 = new BigDecimal(accountmap3.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(4).compareTo(fAvailAmount3), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fFreezeAmount3), "数据库验证fFreezeAmount");

			Logger.comment("验证金额" + accountid4);
			Account accountmap4 = new AccountWapper().selectAccountInfo(accountid4).get(0);
			BigDecimal fAvailAmount4 = new BigDecimal(accountmap4.getAvailAmount().toString());
			BigDecimal fFreezeAmount4 = new BigDecimal(accountmap4.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fAvailAmount4), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(4).compareTo(fFreezeAmount4), "数据库验证fFreezeAmount");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_037() {
		Logger.start(false, "账户1余额增加账户2冻结金额增加账户3余额减少账户4冻结金额减少时账户3余额不足,操作失败,验证流水表不增加数据余额不变");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(0), new BigDecimal(0));
			AccountCallServiceV2.resetAccount(accountid2, new BigDecimal(0), new BigDecimal(0));
			AccountCallServiceV2.resetAccount(accountid3, new BigDecimal(1), new BigDecimal(0));
			AccountCallServiceV2.resetAccount(accountid4, new BigDecimal(0), new BigDecimal(10));
			BigDecimal fundin = new BigDecimal(6);
			BigDecimal freezeamount = new BigDecimal(6);
			BigDecimal unfreezeamount = new BigDecimal(6);
			BigDecimal fundout = new BigDecimal(6);
			String appid = "AutoTest";
			// bizcode 假装用佣金bizcode 暂无
			int bizcode = 300008;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItems.add(AccountCallServiceV2.getFundinBean(accountid1, fundin, bizcode, oNo));
			AccountingItems.add(AccountCallServiceV2.getFreezeBean(accountid2, freezeamount, bizcode, oNo));
			AccountingItems.add(AccountCallServiceV2.getFundoutBean(accountid3, unfreezeamount, bizcode, oNo));
			AccountingItems.add(AccountCallServiceV2.getUnfreezeBean(accountid4, fundout, bizcode, oNo));
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(ECode.BALANCES_INSUFFICIENT_CODE, accountingCall.getStatus(), "验证StatusCode");
			Logger.verifyIsContains(ECode.BALANCES_INSUFFICIENT, accountingCall.getMsg(), "验证Msg包含信息");
			Logger.comment("验证金额" + accountid1);
			Account accountmap = new AccountWapper().selectAccountInfo(accountid1).get(0);
			BigDecimal fAvailAmount = new BigDecimal(accountmap.getAvailAmount().toString());
			BigDecimal fFreezeAmount = new BigDecimal(accountmap.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fAvailAmount), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fFreezeAmount), "数据库验证fFreezeAmount");

			Logger.comment("验证金额" + accountid2);
			Account accountmap2 = new AccountWapper().selectAccountInfo(accountid2).get(0);
			BigDecimal fAvailAmount2 = new BigDecimal(accountmap2.getAvailAmount().toString());
			BigDecimal fFreezeAmount2 = new BigDecimal(accountmap2.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fAvailAmount2), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fFreezeAmount2), "数据库验证fFreezeAmount");

			Logger.comment("验证金额" + accountid3);
			Account accountmap3 = new AccountWapper().selectAccountInfo(accountid3).get(0);
			BigDecimal fAvailAmount3 = new BigDecimal(accountmap3.getAvailAmount().toString());
			BigDecimal fFreezeAmount3 = new BigDecimal(accountmap3.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(1).compareTo(fAvailAmount3), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fFreezeAmount3), "数据库验证fFreezeAmount");

			Logger.comment("验证金额" + accountid4);
			Account accountmap4 = new AccountWapper().selectAccountInfo(accountid4).get(0);
			BigDecimal fAvailAmount4 = new BigDecimal(accountmap4.getAvailAmount().toString());
			BigDecimal fFreezeAmount4 = new BigDecimal(accountmap4.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fAvailAmount4), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(10).compareTo(fFreezeAmount4), "数据库验证fFreezeAmount");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_038() {
		Logger.start(false, "账户1余额增加账户2冻结金额增加账户3余额减少账户4冻结金额减少时账户4冻结金额入账金额不足,操作失败,验证流水表不增加数据余额不变");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(0), new BigDecimal(0));
			AccountCallServiceV2.resetAccount(accountid2, new BigDecimal(0), new BigDecimal(0));
			AccountCallServiceV2.resetAccount(accountid3, new BigDecimal(10), new BigDecimal(0));
			AccountCallServiceV2.resetAccount(accountid4, new BigDecimal(0), new BigDecimal(1));
			BigDecimal fundin = new BigDecimal(6);
			BigDecimal freezeamount = new BigDecimal(6);
			BigDecimal unfreezeamount = new BigDecimal(6);
			BigDecimal fundout = new BigDecimal(6);
			String appid = "AutoTest";
			// bizcode 假装用佣金bizcode 暂无
			int bizcode = 300008;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItems.add(AccountCallServiceV2.getFundinBean(accountid1, fundin, bizcode, oNo));
			AccountingItems.add(AccountCallServiceV2.getFreezeBean(accountid2, freezeamount, bizcode, oNo));
			AccountingItems.add(AccountCallServiceV2.getFundoutBean(accountid3, unfreezeamount, bizcode, oNo));
			AccountingItems.add(AccountCallServiceV2.getUnfreezeBean(accountid4, fundout, bizcode, oNo));
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(ECode.FREEZE_INSUFFICIENT_CODE, accountingCall.getStatus(), "验证StatusCode");
			Logger.verifyIsContains(ECode.FREEZE_INSUFFICIENT, accountingCall.getMsg(), "验证Msg包含信息");
			Logger.comment("验证金额" + accountid1);
			Account accountmap = new AccountWapper().selectAccountInfo(accountid1).get(0);
			BigDecimal fAvailAmount = new BigDecimal(accountmap.getAvailAmount().toString());
			BigDecimal fFreezeAmount = new BigDecimal(accountmap.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fAvailAmount), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fFreezeAmount), "数据库验证fFreezeAmount");

			Logger.comment("验证金额" + accountid2);
			Account accountmap2 = new AccountWapper().selectAccountInfo(accountid2).get(0);
			BigDecimal fAvailAmount2 = new BigDecimal(accountmap2.getAvailAmount().toString());
			BigDecimal fFreezeAmount2 = new BigDecimal(accountmap2.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fAvailAmount2), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fFreezeAmount2), "数据库验证fFreezeAmount");

			Logger.comment("验证金额" + accountid3);
			Account accountmap3 = new AccountWapper().selectAccountInfo(accountid3).get(0);
			BigDecimal fAvailAmount3 = new BigDecimal(accountmap3.getAvailAmount().toString());
			BigDecimal fFreezeAmount3 = new BigDecimal(accountmap3.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(10).compareTo(fAvailAmount3), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fFreezeAmount3), "数据库验证fFreezeAmount");

			Logger.comment("验证金额" + accountid4);
			Account accountmap4 = new AccountWapper().selectAccountInfo(accountid4).get(0);
			BigDecimal fAvailAmount4 = new BigDecimal(accountmap4.getAvailAmount().toString());
			BigDecimal fFreezeAmount4 = new BigDecimal(accountmap4.getFreezeAmount().toString());
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fAvailAmount4), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(1).compareTo(fFreezeAmount4), "数据库验证fFreezeAmount");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_039() {
		Logger.start(true, "不输入AccountId传入userid和AccountType(对应AccountId不存在)不传入CurrencyType进行单笔进账操作,自动创建账号成功");
		try {
			BigDecimal amount = new BigDecimal(10);
			String appid = "AutoTest";
			int bizcode = 100001;
			int newuid = AccountCallServiceV2.getNewUid();
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItemBean bean = AccountCallServiceV2.getFundinBean(null, amount, bizcode, oNo);
			bean.setUserId(newuid);
			bean.setAccountType(1);
			bean.setCurrencyType(null);
			AccountingItems.add(bean);
			AccountingItems.add(AccountCallServiceV2.getFundinBean(accountid1, amount, bizcode, oNo));
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(0, accountingCall.getStatus(), "验证StatusCode");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_040() {
		Logger.start(true, "不输入AccountId传入userid和AccountType(对应AccountId不存在)不传入CurrencyType进行多笔进账操作,自动创建账号成功");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(3), new BigDecimal(3));
			BigDecimal amount = new BigDecimal(10);
			String appid = "AutoTest";
			int bizcode = 100001;
			int newuid = AccountCallServiceV2.getNewUid();
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItemBean bean = AccountCallServiceV2.getFundinBean(null, amount, bizcode, oNo);
			bean.setUserId(newuid);
			bean.setAccountType(1);
			bean.setCurrencyType(null);
			AccountingItems.add(bean);
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(0, accountingCall.getStatus(), "验证StatusCode");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_041() {
		Logger.start(true, "数据多笔操作使用不同userid,返回成功");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(0), new BigDecimal(0));
			BigDecimal amount = new BigDecimal(10);
			String appid = "AutoTest";
			int bizcode = 100001;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItemBean bean = AccountCallServiceV2.getFundinBean(accountid1, amount, bizcode, oNo);
			AccountingItemBean bean2 = AccountCallServiceV2.getFundinBean(accountid1, amount, bizcode, oNo);
			bean.setAccountId(null);
			bean2.setAccountId(null);
			bean.setUserId(100);
			bean2.setUserId(200);
			bean.setAccountType(1);
			bean2.setAccountType(1);
			bean2.setBizNo(bean.getBizNo());
			bean2.setOriginalNo(bean.getOriginalNo());
			AccountingItems.add(bean);
			AccountingItems.add(bean2);
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(0, accountingCall.getStatus(), "验证StatusCode");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_042() {
		Logger.start(false, "数据多笔操作使用相同userid,返回失败，重复指令");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(0), new BigDecimal(0));
			BigDecimal amount = new BigDecimal(10);
			String appid = "AutoTest";
			int bizcode = 100001;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItemBean bean = AccountCallServiceV2.getFundinBean(accountid1, amount, bizcode, oNo);
			AccountingItemBean bean2 = bean;
			bean.setAccountId(null);
			bean2.setAccountId(null);
			bean.setUserId(100);
			bean2.setUserId(100);
			bean.setAccountType(1);
			bean2.setAccountType(1);
			AccountingItems.add(bean);
			AccountingItems.add(bean2);
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(2, accountingCall.getStatus(), "验证StatusCode");
			Logger.verifyEquals(ECode.INSTRUCTION_REPEAT, accountingCall.getMsg(), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_043() {
		Logger.start(true, "不输入AccountId传入userid(对应AccountId不存在)不传入AccountType进行单笔进账操作,自动创建账号成功");
		try {
			BigDecimal amount = new BigDecimal(10);
			String appid = "AutoTest";
			int bizcode = 100001;
			int newuid = AccountCallServiceV2.getNewUid();
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItemBean bean = AccountCallServiceV2.getFundinBean(null, amount, bizcode, oNo);
			bean.setUserId(newuid);
			bean.setAccountType(null);
			bean.setCurrencyType(null);
			AccountingItems.add(bean);
			AccountingItems.add(AccountCallServiceV2.getFundinBean(accountid1, amount, bizcode, oNo));
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(0, accountingCall.getStatus(), "验证StatusCode");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_044() {
		Logger.start(false, "多笔完全幂等，重复出入账失败");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(0), new BigDecimal(0));
			BigDecimal amount = new BigDecimal(10);
			String appid = "AutoTest";
			int bizcode = 100001;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItemBean bean = AccountCallServiceV2.getFundinBean(accountid1, amount, bizcode, oNo);
			AccountingItemBean bean2 = AccountCallServiceV2.getFundinBean(accountid1, amount, bizcode, oNo);;
			AccountingItems.add(bean);
			AccountingItems.add(bean2);
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();
			accountingCall.callService();
			Logger.verifyEquals(4, accountingCall.getStatus(), "验证StatusCode");
			Logger.verifyIsContains(ECode.IDEMPOTENT, accountingCall.getMsg(), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_045() {
		Logger.start(false, "多笔不完全幂等，重复出入账失败");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(0), new BigDecimal(0));
			BigDecimal amount = new BigDecimal(10);
			String appid = "AutoTest";
			int bizcode = 100001;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItemBean bean = AccountCallServiceV2.getFundinBean(accountid1, amount, bizcode, oNo);
			AccountingItemBean bean2 = AccountCallServiceV2.getFundinBean(accountid1, amount, bizcode, oNo);
			AccountingItemBean bean3 = AccountCallServiceV2.getFundinBean(accountid1, amount, bizcode, oNo);
			AccountingItems.add(bean);
			AccountingItems.add(bean2);
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();
			AccountingItems.add(bean3);
			accountingCall.callService();
			Logger.verifyEquals(5, accountingCall.getStatus(), "验证StatusCode");
			Logger.verifyIsContains(ECode.NOALLIDEMPOTENT, accountingCall.getMsg(), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_046() {
		Logger.start(false, "余额出账第一笔成功后第二笔幂等+金额不足，重复出入账失败");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(10), new BigDecimal(0));
			BigDecimal amount = new BigDecimal(10);
			String appid = "AutoTest";
			int bizcode = 100001;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItemBean bean = AccountCallServiceV2.getFundoutBean(accountid1, amount, bizcode, oNo);
			AccountingItems.add(bean);
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(false,accountingBean);
			accountingCall.callService();
			accountingCall=new AccountingCall();
			Logger.comment("第一次成功后第二次金额不足时重复入账,幂等失败");
			accountingCall.setData(false,accountingBean);
			accountingCall.callService();
			Logger.verifyEquals(4, accountingCall.getStatus(), "验证StatusCode");
			Logger.verifyIsContains(ECode.IDEMPOTENT, accountingCall.getMsg(), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_047() {
		Logger.start(false, "冻结出账第一笔成功后第二笔幂等+金额不足，重复出入账失败");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(0), new BigDecimal(10));
			BigDecimal amount = new BigDecimal(10);
			String appid = "AutoTest";
			int bizcode = 100001;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItemBean bean = AccountCallServiceV2.getUnfreezeBean(accountid1, amount, bizcode, oNo);
			AccountingItems.add(bean);
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(false,accountingBean);
			accountingCall.callService();
			accountingCall=new AccountingCall();
			Logger.comment("第一次成功后第二次金额不足时重复入账,幂等失败");
			accountingCall.setData(false,accountingBean);
			accountingCall.callService();
			Logger.verifyEquals(4, accountingCall.getStatus(), "验证StatusCode");
			Logger.verifyIsContains(ECode.IDEMPOTENT, accountingCall.getMsg(), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_Accounting_048() {
		Logger.start(false, "第一笔第二笔皆幂等+金额不足，金额不足失败");
		try {
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(0), new BigDecimal(0));
			BigDecimal amount = new BigDecimal(10);
			String appid = "AutoTest";
			int bizcode = 100001;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItemBean bean = AccountCallServiceV2.getFundoutBean(accountid1, amount, bizcode, oNo);
			AccountingItems.add(bean);
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();
			Logger.verifyEquals(ECode.BALANCES_INSUFFICIENT_CODE, accountingCall.getStatus(), "验证StatusCode");
			Logger.verifyIsContains(ECode.BALANCES_INSUFFICIENT, accountingCall.getMsg(), "验证Msg");
			accountingCall=new AccountingCall();
			Logger.comment("再次调用,金额不足时重复入账,期望金额不足");
			accountingCall.setData(accountingBean);
			accountingCall.callService();
			Logger.verifyEquals(ECode.BALANCES_INSUFFICIENT_CODE, accountingCall.getStatus(), "验证StatusCode");
			Logger.verifyIsContains(ECode.BALANCES_INSUFFICIENT, accountingCall.getMsg(), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_Accounting_049() {
		Logger.start(true, "传入数据库存在的AccountId进行单笔进账操作,单笔进账成功,验证余额和流水表数据JIRACONN-18470增加全球买手专项保证金");
		try {
			int userId = 1;
			String accountid = AccountCallServiceV2.getAccountId(userId, 17);
			AccountCallServiceV2.resetAccount(accountid, new BigDecimal(0), new BigDecimal(0));
			BigDecimal amount = new BigDecimal(10);
			String appid = "AutoTest";
			// 全球买手专项保证金
			int bizcode = 101703;
			accountingBean.setAppId(appid);
			List<AccountingItemBean> AccountingItems = new ArrayList<AccountingItemBean>();
			String oNo = TestDataManager.getRandomUUID().toString();
			AccountingItems.add(AccountCallServiceV2.getFundinBean(accountid1, amount, bizcode, oNo));
			accountingBean.setAccountingItems(AccountingItems);
			accountingCall.setData(accountingBean);
			accountingCall.callService();

			Logger.verifyEquals(0, accountingCall.getStatus(), "验证StatusCode");
			Logger.comment("验证流水");
			AccountEntry yae = new AccountWapper().selectAccountEntry(accountid1, oNo).get(0);
			Logger.verifyEquals(accountid1, yae.getAccountId(), "数据库验证accountid");
			Logger.verifyEquals(0, amount.compareTo(yae.getAmount()), "数据库验证发生金额amount");
			Logger.verifyEquals(appid, yae.getAppId(), "数据库验证AppId");

			Logger.verifyEquals(0, amount.compareTo(yae.getAvailAmount()), "数据库验证Availamount");
			Logger.verifyEquals(bizcode, yae.getBizCode(), "数据库验证Bizcode");
			Logger.verifyEquals(AccountingItems.get(0).getBizNo(), yae.getBizNo(), "数据库验证Bizcode");
			// 2 可用余额
			Logger.verifyEquals(2, yae.getEntryType(), "数据库验证Entrytype");
			Logger.verifyEquals(AccountingItems.get(0).getMemo(), yae.getMemo(), "数据库验证Memo");
			Logger.verifyEquals(oNo, yae.getOriginalNo(), "数据库验证Originalno");
			Logger.verifyEquals(Integer.valueOf(EnvSetup.getData("accountuid1")), yae.getUserId(), "数据库验证Userid");
			Logger.comment("验证金额");
			Account accountmap = new AccountWapper().selectAccountInfo(accountid1).get(0);
			BigDecimal fAvailAmount = new BigDecimal(accountmap.getAvailAmount().toString());
			BigDecimal fFreezeAmount = new BigDecimal(accountmap.getFreezeAmount().toString());
			Logger.verifyEquals(0, amount.compareTo(fAvailAmount), "数据库验证fAvailAmount");
			Logger.verifyEquals(0, new BigDecimal(0).compareTo(fFreezeAmount), "数据库验证fFreezeAmount");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}